<?php
	include_once('themes/head.php');
	include_once('controller/indexController.php');
?>
<div id="tengah">
	<div id="kiri">
		<h2>SELAMAT DATANG</h2>
		<p>Mari Sukseskan Agribisnis Anda bersama Kami,</p>
	Kami siap membantu anda dalam melakukan proses jual beli alat-alat pertanian dan hasil tani anda secara Online.
     <p> Karena Kami adalah Mitra Anda </p>
	
	<h2>INFO DISKON</h2>
	<div id="myCarousel" class="carousel slide">

                <div class="carousel-inner">
				<?php
				if($caro==0)
				{
				?>
							<div class="item active">
								<img src="" alt="">
								<div class="carousel-caption">
								  <h4>Tidak ada</h4>
								  <p>Kosong</p>
								</div>
							  </div>
				<?php
				}
				else
				{
					$i=0;
					foreach($caro as $tampilkan)
					{
				
							if($i==0)
							{
								echo "<div class=\"item active\">";
							}
							else
							{
								echo "<div class=\"item\">";
							}
							echo '<img class="img-polaroid" src="data:image/jpeg;base64,' . base64_encode(stripslashes($tampilkan['gambar_carosel'] )) . '" />'; 
							?>
								<div class="carousel-caption">
								  <h4><?php echo $tampilkan['judul_caro']; ?></h4>
								  <p><?php echo $tampilkan['deskripsi_caro']; ?></p>
								</div>
							  </div>
				<?php
					$i++;
					if($i>3)
					{
						$i=0;
					}
					}
				}
				?>
                <a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>
                <a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>
    </div>
			  
			  
	<?php
		if(isset($_SESSION['login']) && $_SESSION['level']==5)
		{
	?>
		<button type="submit" name="open_caro" class="btn" id="open_btn" onclick="caro()">Buat Carosel</button>
	<?php
		}
	?>	
	<?php
	if(isset($error_caro))
	{
		echo "<div class=\"alert alert-error\" id=\"alert\">Salah ! ".$error_caro."<button type=\"button\" class=\"close\" data-dismiss=\"alert\" id=\"close\">×</button></div>";
	}
	if(isset($success_caro))
	{
		echo "<div class=\"alert alert-success\">".$success_caro."<button type=\"button\" class=\"close\" data-dismiss=\"alert\" id=\"close\">×</button></div>";
	}
	?>
		<div id="insertcarosel" class="insertcarosel">
		<form class="form-horizontal" method="post" action="#" enctype="multipart/form-data">
		<div class="control-group">
			<label class="control-label" for="inputNama">Judul</label>
				<div class="controls">
					<input type="text" name="judul_caro" id="inputNama" placeholder="Judul carosel">
				</div>
		</div>
		<div class="control-group">
			<label class="control-label" for="inputNama">Deskripsi Carosel</label>
				<div class="controls">
					<textarea rows="3" name="deskripsi_caro" id="inputNama" placeholder="Deskripsi Carosel"></textarea>
				</div>
		</div>
		<div class="control-group">
			<label class="control-label" for="inputNama">Produk</label>
				<div class="controls">
					<input type="text" name="id_produk" id="inputNama" placeholder="Produk">
				</div>
		</div>
		<div class="control-group">
			<label class="control-label" for="inputNama">Gambar Carosel</label>
				<div class="controls">
					<input type="hidden" name="MAX_FILE_SIZE" value="160000">
					<input type="file" name="gambar_caro" id="inputNama" placeholder="Gambar Produk">
				</div>
		</div>
		<div class="control-group">
			<div class="controls">
				<button type="submit" name="buat_carosel" class="btn" id="buat_btn">Buat</button>
				<button type="submit" name="batal_carosel" class="btn" id="batal_btn" onclick="batal()">Batal</button>
			</div>
		</div>
		</form>
		</div>
	
	<div id="tampil_produk">
	<div id="terlaris">
	<h2>Produk Terlaris</h2>
	<table class="table" width="700" border="0" cellpadding="0" cellspacing="0" bordercolor="#000000">
	<?php
		if($data_tampil==0)
		{
	?>
      <tr>
        <td class="bodyText">Belum Laku</td>
      </tr>
	  
	 <?php
		}
		else
		{
	?>
		<tr>
		<td>
			<table >
	<?php
			foreach($data_tampil as $produks)
			{
	?>
			<tr>
				<td><?php echo $produks['nama']; ?>	</td>
			</tr>
			<tr>
				<td>
				<?php
					echo "<br /><a href=\"detail_produk.php?detail&id_det=".$produks['id_produk']."\"><img class=\"img-polaroid\" src=\"data:image/jpeg;base64," . base64_encode(stripslashes($produks['gambar'] )) . "\" /></a>";
				?>
				</td>
			</tr>
	<?php
			}
		}
	 ?>
			</table>
		</td>
	 </tr>
    </table>
		</div>
		<div id="terbaru">
	<h2>Produk Terbaru</h2>
	<table class="table" width="700" border="0" cellpadding="0" cellspacing="0" bordercolor="#000000">
	<?php
		if($data_new==0)
		{
	?>
      <tr>
        <td class="bodyText">Tidak ada</td>
      </tr>
	  
	 <?php
		}
		else
		{
	?>
		<tr>
		<td>
			<table >
	<?php
			foreach($data_new as $produks_new)
			{
	?>
			<tr>
				<td><?php echo $produks_new['nama']; ?>	</td>
			</tr>
			<tr>
				<td>
				<?php
					echo "<br /><a href=\"detail_produk.php?detail&id_det=".$produks_new['id']."\"><img class=\"img-polaroid\" src=\"data:image/jpeg;base64," . base64_encode(stripslashes($produks_new['gambar'] )) . "\" /></a>";
				?>
				</td>
			</tr>
	<?php
			}
		}
	 ?>
			</table>
		</td>
	 </tr>
    </table>
		</div>
	</div>
	</div>

</div>
<div id="kanan">
	<p><span class="subHeader style2">Website Link</span></p>
			<p><br />
		      <a href="http://tanamanpangan.deptan.go.id/"><strong>Deptan Tanaman Pangan</strong></a></p>
			<p><strong><a href="www.deptan.go.id">Departemen Pertanian</a></strong></p>
			<p><strong><a href="http://pangan.litbang.deptan.go.id">Badan Litbang Pertanian </a></strong></p>
			<h3><a href="http://www.google.co.id/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;cad=rja&amp;ved=0CB0QFjAA&amp;url=http%3A%2F%2Ftanamanpangan.deptan.go.id%2F&amp;ei=nnN5ULPrF5DkrAeEnYCABQ&amp;usg=AFQjCNHKEEsjnzFPQO_b90xh78KYeP-b6g&amp;sig2=TlJZ5muFkZe1BtK7y0JjDQ" onmousedown="return rwt(this,'','','','1','AFQjCNHKEEsjnzFPQO_b90xh78KYeP-b6g','TlJZ5muFkZe1BtK7y0JjDQ','0CB0QFjAA',null,event)"></a></h3>
			<p>&nbsp;</p>
			<a href="http://freehitcountercode.com/"><img border="0" src="http://www.freehitcountercode.com/counter.php?b=ffffff&r=000000&f=0000ff&unique=0&start=0" width="120" height="30" /></a><br /><span style="font-size: 5%;"><a href="http://freehitcountercode.com/">free website hit counter code</a></span>
			
			<p class="style3">Anda Pengunjung ke :</p>
			<form id="form2" name="form2" method="post" action="">
              <label></label>
              <label>
              <textarea name="textarea2">1010</textarea>
              </label>
			</form>
			<p class="style3">IP Anda </p>
			<p>
			  <textarea name="textarea">172.17.6.245</textarea>
  </p>
			<p>Jika Anda Kesulitan? Hubungi Kami, Kami Siap membantu</p>
			<p><img src="yahoo_chat.png" width="122" height="101"> </p>
         <iframe src="http://www.google.com/talk/service/badge/Show?tk=z01q6amlqetp571a3q00heusqfgc3ohbmgbvg6eqb03j9a82cciiupob83hruobkqlnt7v01ral91vrmke75d0ihsv9jlne9j2ppihd5frsk64t5uheqcoi523un6m8h8eb2hkos87fadgcpmlr51gjhvgrhri0s1h7tug7t1&amp;w=200&amp;h=60" allowtransparency="true" frameborder="0" height="60" width="200"></iframe>
			<object id="pingboxcu3fve7cx0w0W" type="application/x-shockwave-flash" data="http://wgweb.msg.yahoo.com/badge/Pingbox.swf" width="240" height="420"><param name="movie" value="http://wgweb.msg.yahoo.com/badge/Pingbox.swf" /><param name="allowScriptAccess" value="always" /><param name="flashvars" value="wid=hq4rt3moQnujZyP.k_2wZ8R_PYdUqEdiFg0-" /></object>
			<blockquote>
			  <p>&nbsp;</p>
  </blockquote>
			<p>&nbsp;        </p>
</div>
<?php
	include_once('themes/footer.php');
?>

<script type="text/javascript">
	var url;
	function caro(){
		$('#insertcarosel').show();
		$('#open_btn').hide();
		return false;
	}
	function batal(){
		$('#insertcarosel').hide();
		$('#open_btn').show();
		return false;
	}
</script>